# -*- coding: utf-8 -*-

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.core import urlresolvers
from django.contrib.auth.models import User

"""
    Global statistics
    One week or month
"""
class Statistics(models.Model):

    CH_STATUS = (
        ('P', u'Present'),
        ('L', u'Lapsed'),
    )

    num_deads = models.PositiveIntegerField(verbose_name=_(u'Number of dead ants'), blank=False, null=False, default=0)

    games = models.PositiveSmallIntegerField(verbose_name=_(u'Number of games played'), blank=False, null=False, default=0)

    games_win = models.PositiveSmallIntegerField(verbose_name=_(u'Number of games won'), blank=False, null=False, default=0)

    games_lose = models.PositiveSmallIntegerField(verbose_name=_(u'Number of games lost'), blank=False, null=False, default=0)

    user_profile = models.ForeignKey(User, verbose_name=_(u'User Profile'), blank=False, null=False, related_name='statistics')

    #user_profile = models.ForeignKey('public_web.UserProfile', verbose_name=_(u'User Profile'), blank=False, null=False, related_name='players')

    date_created  = models.DateTimeField(null=True, auto_now_add=True)

    date_updated  = models.DateTimeField(null=True, auto_now=True)

    class Meta:
        app_label = 'game'
        verbose_name = _(u'Statistic')
        verbose_name_plural = _(u'Statistics')

    def __unicode__(self):
        return unicode(self.id)

